﻿using System;
using System.Windows.Forms;

namespace WindowsApplication2.基础.数据类型.类型转换
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1_Click(object sender, EventArgs e)
        {
            string strTest = this.textBox1.Text;
            if (strTest == "")
            {
                //MessageBox.Show();
                return;
            }

            try
            {
                byte i = Convert.ToByte(strTest);
                this.textBox2.Text = i.ToString();
            }
            catch (Exception ee)
            {
                MessageBox.Show("无法转换");
            }
        }

        private void Form1_Load(object sender, EventArgs e)
        {
        }
    }
}